//
//  upLoadForSecond.m
//  A段项目
//
//  Created by dllo on 16/1/28.
//  Copyright © 2016年 Scott. All rights reserved.
//

#import "upLoadForSecond.h"
#import "HomePageCell.h"


@interface upLoadForSecond ()<UICollectionViewDelegate,UICollectionViewDataSource>

@property (nonatomic, retain) UICollectionView *upLoadCollectionView;



@end

@implementation upLoadForSecond

- (void)dealloc {
    
    [_upLoadCollectionView release];
    
    [super dealloc];
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.arrImage = [NSMutableArray array];
   
//    self.imageView = [[UIImageView alloc] initWithImage:self.image];
//    
//    self.imageView.frame = CGRectMake(10, 220, 120, 120);
//    
//    [self.view addSubview:self.imageView];
//    
//    [self createCollectionView];
    
}


- (void)createCollectionView {
    
    UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    
    layout.itemSize = CGSizeMake(120, 120);
    
    
    self.upLoadCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(10, 220, self.view.frame.size.width, 120) collectionViewLayout:layout];
    
    [self.view addSubview:self.upLoadCollectionView];
    
    self.upLoadCollectionView.delegate = self;
    
    self.upLoadCollectionView.dataSource = self;
    
    [self.upLoadCollectionView registerClass:[HomePageCell class] forCellWithReuseIdentifier:@"pool1"];
    
    [_upLoadCollectionView release];
    
    [layout release];
    
    
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    
    
    
    return self.arrImage.count;
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    
    HomePageCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"pool1" forIndexPath:indexPath];
    
    UIImage *image = [self.arrImage objectAtIndex:indexPath.item];
    
    cell.imageView.image = image;
    
    return cell;
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
